<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/default.css" />
		<link rel="stylesheet" type="text/css" href="css/style1.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav" id='header'>
			<a class="mui-action-back white-big mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title white-big">我发布的榜单</h1>
		</header>
		<!--下拉刷新容器-->
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll">
				<ul class="mui-table-view mui-table-view-chevron" id="tabcell">
					<!--<li class="mui-table-view-cell lists1">
						<a href="coindetail2.html">
							<h3 class="blacker-big">每日币市龙虎榜</h3>
							<section>
								<dl class="leftslide fl">
									<dd class="blacker-small">EOS领涨<span class="green-small">+2.39%</span></dd>
									<dd>
										<span class="grey-light">总数：3</span>
										<span class="grey-light">上涨：2</span>
										<span class="grey-light">下跌：1</span>
									</dd>
									<dd>
										<img src="http://placehold.it/40x30" alt="" class='imgsma-peopl' />
										<i class="m-icon-bluev"></i>
										<span class="blacker-small">金木研</span>
										<span class="grey-light">创建</span>
									</dd>
								</dl>

								<dl class='rightslide fr'>
									<dd class="tr blacker-small">平均涨跌</dd>
									<dd class="tr green-big">+1.29%</dd>
									<dt>
        					<p>
        						<span class="iconfont icon-yanjing"></span>
        						<span class='grey-smaller'>2100</span>
        						<span class="iconfont icon-xingxing"></span>
        						<span class="grey-smaller">1920</span>
        					</p>
        				</dt>
								</dl>
							</section>
						</a>
					</li>
					-->
				</ul>
			</div>
		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/jquery-2.1.3.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="js/config.js" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init({
				pullRefresh: {
					container: '#pullrefresh',
					down: {
						auto: true,
						style: 'circle',
						callback: pulldownRefresh
					},
					up: {
						auto: true,
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
			});
			var pageNumber = 1;

			function pulldownRefresh() {
				console.log("下拉刷新");
				pageNumber = 1;
				$('#tabcell').html('');
				gethlist();
				mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
				mui.toast("刷新完成");
			}

			function pullupRefresh() {
				console.log("上拉加载");
				pageNumber = pageNumber + 1;
				gethlist();
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //参数为true代表没有更多数据了。
			}

			//初始数据
			function gethlist() {
				var uid = localStorage.getItem("uid");
				if(uid == null || uid == "") {
					toLogin();
					return;
				}
				//推荐榜单
				mui.ajax(mkurl + '/api/market/myhlist', {
					data: {
						uid: uid,
						pageNumber: pageNumber,
						status: 1,
						pageSize: 10
					},
					dataType: 'json',
					type: 'post',
					success: function(data) {
						if(data.status == 1) {
							var cData = data.result.result;
							var tabcell;
							if(cData != null && cData != '') {
								for(var i = 0; i < cData.length; i++) {
									var fun = 'toListDetail("' + cData[i].hid + '")';
									var brcont = cData[i].browseCount;
									if(brcont == null || brcont == "") {
										brcont = 0;
									}
									var followCount = cData[i].followCount;
									tabcell = '<li class="mui-table-view-cell lists1" id="coin_list"' + [i] +
										'><a onclick=' + fun + '><h3 class="blacker-big">' + cData[i].title +
										'</h3><section><dl class="leftslide fl"><dd class="blacker-small">' + cData[i].rHUom +
										'&nbsp;<span class="green-small">' + cData[i].rhAverage +
										'%</span></dd><dd><span class="grey-light">总数:' + cData[i].totalCount +
										'</span><span class="grey-light">上涨:' + cData[i].rCount +
										'</span><span class="grey-light">下跌：' + cData[i].fCount +
										'</span></dd><dd><img src="images/header.png" alt="" class="imgsma-peopl" />' +
										'<i class="m-icon-bluev"></i><span class="blacker-small">' + cData[i].nickname +
										'</span><span class="grey-light">创建</span></dd></dl><dl class="rightslide fr">' +
										'<dd class="tr blacker-small">平均涨跌</dd><dd class="tr green-big">' + cData[i].averageRF +
										'%</dd><dt><p><span class="iconfont icon-yanjing"></span>' +
										'<span class="grey-smaller">' + brcont + '</span><span class="iconfont icon-xingxing"></span>' +
										'<span class="grey-smaller">' + followCount + '</span></p></dt></dl></section></a></li>';
									$('#tabcell').append(tabcell);
								}
							} else {
								mui.toast("没有更多了");
								mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); //参数为true代表没有更多数据了。
							}

						} else if(data.code == -1) {
							toLogin();
						} else {
							mui.toast(data.message)
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理；
						console.log(type);
					}
				});
			}

			function toListDetail(hid) {
				mui.ajax(userurl + '/api/user/app/uhit', {
					data: {
						hid: hid
					},
					dataType: 'json',
					type: 'post',
					async: true,
					success: function(data) {
						//console.log('success');
					},
					error: function(xhr, type, errorThrown) {
						console.log(type);
					}
				});
				if(hid != null && hid != "") {
					mui.openWindow({
						url: 'coindetail2.html',
						id: 'coindetail2',
						extras: {
							hid: hid
						}
					});
				} else {
					mui.toast('未知榜单', {
						duration: '2000ms',
						type: 'div'
					})
				}
			}
		</script>
	</body>

</html>